<%--
    Document   : nuevo
    Created on : 10/09/2009, 02:27:59 PM
    Author     : Freddy
--%>

<%@page contentType="text/html"%>
<%@page pageEncoding="UTF-8"%>

<%@taglib prefix="f" uri="http://java.sun.com/jsf/core"%>
<%@taglib prefix="h" uri="http://java.sun.com/jsf/html"%>
<%@taglib prefix="t" uri="http://myfaces.apache.org/tomahawk"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@taglib prefix="rich" uri="http://richfaces.org/rich"%>
<%@taglib prefix="a4j" uri="http://richfaces.org/a4j"%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<%
        request.setAttribute("nombrePagina", "Plantilla");
%>
<f:view>
    <%@include file="/WEB-INF/jspf/header.jspf" %>

    <%@include file="/WEB-INF/jspf/breadcumbs.jspf" %>

    
    <html>
        <head>
            <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
            <title>Levantar Garant&iacute;as</title>
        </head>
        <body>
            <h1>Levantar Garant&iacute;as</h1>
            <h2>Levantar Garant&iacute;as</h2>
            <h:messages id="messages" styleClass="messages_content" layout="table" errorClass="error" warnClass="warn" infoClass="info"/>
            
            <h:form>
                
                <fieldset>
                    <legend>Levantar Garant&iacute;as</legend>
                    <a4j:outputPanel id="panelRender" ajaxRendered="true">
                    <h:panelGrid columns="2">
                        <h:outputLabel value="Buscar Garantia por: " for="cboTipo" />
                        <h:selectOneMenu id="cboTipo" value="#{EstadoGarantiaController.verPor}">
                            <a4j:support event="onchange" reRender="panelDNI,panelListaDNI" />
                            <f:selectItem itemValue="DNI" itemLabel="DNI" />
                            <f:selectItem itemValue="Nro. Cuenta" itemLabel="Nro. Cuenta" />
                        </h:selectOneMenu>
                    </h:panelGrid>
                    <h:panelGrid id="panelDNI" columns="3" rendered="#{EstadoGarantiaController.verPorDNI}">
                        <h:outputLabel value="DNI: " for="txtDNI" />
                        <h:inputText value="#{EstadoGarantiaController.DNI}" id="txtDNI" />
                        <h:commandButton action="buscar" id="btnBuscar" value="Buscar" />
                    </h:panelGrid>
                    </a4j:outputPanel>
                </fieldset>
                
                <fieldset>
                    <legend>Lista Garant&iacute;as</legend>
                    <h:panelGrid id="panelListaDNI" columns="1" rendered="#{EstadoGarantiaController.verPorDNI}">
                            <t:dataTable id="tblGarantias" value="#{EstadoGarantiaController.estadosGarantiasPorDNI}"
                                         var="item" rowClasses="TableRow1,TableRow2" columnClasses="TableColumn"
                                         bgcolor="#F1F1F1" border="10" cellpadding="5"
                                         cellspacing="3" first="0"
                                         frame="hsides" rules="all"
                                         styleClass="TableClass" headerClass="TableHeader" footerClass="TableFooter" rows="4" >
                                <t:column>
                                    <f:facet name="header"><t:outputText value="CodGar"/></f:facet>
                                    <h:outputText value="#{item.fidGarGarantia.idGarantia}" />
                                </t:column>
                                <t:column>
                                    <f:facet name="header"><t:outputText value="Nombre Cliente"/></f:facet>
                                    <h:outputText value="#{item.fidGarGarantia.cliente.nombrePersona} #{item.fidGarGarantia.cliente.apePaternoPersona} #{item.fidGarGarantia.cliente.apeMaternoPersona}" />
                                </t:column>
                                <t:column>
                                <f:facet name="header">
                                    <t:outputText value="Cobertura Garantía"/>
                                </f:facet>
                                <h:outputText value="#{item.fidGarGarantia.cobertura}" />
                                </t:column>
                                <t:column>
                                <f:facet name="header">
                                    <t:outputText value="Tipo Garantía"/>
                                </f:facet>
                                <h:outputText value="#{item.fidGarGarantia.tipogarantia}" />
                                </t:column>
                                <t:column>
                                    <h:commandButton id="btnLevantar"
                                       action="levantar"
                                       value="Levantar">
                                           <f:setPropertyActionListener target="#{EstadoGarantiaController.estadoGarantia}" value="#{item}" />
                                    </h:commandButton>
                                </t:column>
                            </t:dataTable>
                            <t:dataScroller id="scroll"
                                        for="tblGarantias"
                                        fastStep="5"
                                        pageCountVar="pageCount"
                                        pageIndexVar="pageIndex"
                                        styleClass="scroller"
                                        paginator="true"
                                        paginatorMaxPages="8"
                                        paginatorTableClass="paginator"
                                        paginatorActiveColumnStyle="font-weight:bold;"
                                        immediate="true">
                                <f:facet name="first" >
                                    <t:graphicImage url="/flechas/arrow-first.gif" border="1"/>

                                </f:facet>
                                <f:facet name="last">
                                    <t:graphicImage url="/flechas/arrow-last.gif" border="1"/>
                                </f:facet>
                                <f:facet name="previous">
                                    <t:graphicImage url="/flechas/arrow-previous.gif" border="1" />
                                    <h:outputText value="Ant." style="" />
                                </f:facet>
                                <f:facet name="next">
                                    <t:graphicImage url="/flechas/arrow-next.gif" border="1" />
                                    <h:outputText value="Sig." style="" />
                                </f:facet>
                            </t:dataScroller>
                        </h:panelGrid>
                </fieldset>
            </h:form>
            
        </body>
    </html>
    <%@include file="/WEB-INF/jspf/footer.jspf" %>
</f:view>